using UnityEngine;

public class ActiverRandom : MonoBehaviour
{
    public GameObject[] All;
    public int ActiveCount = 1;
    // Start is called before the first frame update
    void Awake()
    {
        if (All == null || All.Length <= 0)
        {
            All = new GameObject[transform.childCount];
            for (int i = 0; i < transform.childCount; i++)
            {
                All[i] = transform.GetChild(i).gameObject;
            }

        }
    }


    private void OnEnable()
    {
        foreach (var a in All)
        {
            a.SetActive(false);
        }
        for (int i = 0; i < ActiveCount; i++)
        {
            int aa = Random.Range(0, All.Length);
            All[aa % All.Length].gameObject.SetActive(true);
        }
    }

}
